/*
 * Copyright 2010 - 2011, The PLDesktop Development Team
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

#ifndef PL_C_WCHAR_T_H
#define PL_C_WCHAR_T_H

#include <stddef.h>

#ifdef	__cplusplus
extern "C" {
#else
typedef unsigned short wchar_t;
#endif

#ifndef NULL
#define NULL 0
#endif

#ifndef WCHAR_MAX
#define WCHAR_MAX 65535
#endif
#ifdef WCHAR_MIN
#define WCHAR_MIN 0
#endif
#ifndef WEOF
#define WEOF -1
#endif

#define iswupper(_c)          ((_c) >= 'A' && (_c) <= 'Z')
#define iswlower(_c)          ((_c) >= 'a' && (_c) <= 'z')
#define towupper(_c)          (iswlower(_c) ? (_c) - 'a' + 'A' : (_c))
#define towlower(_c)          (iswupper(_c) ? (_c) - 'A' + 'a' : (_c))
#define iswdigit(c)				((c) >= '0' && (c) <= '9')
#define iswspace(c)				((c) == '\r' || (c) == '\n' || (c) == '\t' || (c) == ' ' || (c) == 0x0b || (c) == 0x0c)
#define iswalpha(c)				(iswupper(c) || iswlower(c))

typedef struct {
	wchar_t __cp;
	uint16_t __class;
	wchar_t __uc;
	wchar_t __lc;
} __wchar_info_t;

const __wchar_info_t *__lookup_unicode(wchar_t _cp);

#ifdef	__cplusplus
}
#endif

#endif
